package com.ruoyi.framework.config;


import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;


@Component  /*这个注解很重要*/
public class BM_MetaObjectHandler implements MetaObjectHandler {
    /*自动填充配置类*/
    @Override
    public void insertFill(MetaObject metaObject) {
        this.setFieldValByName("bmCreate",new Date() ,metaObject);
        this.setFieldValByName("bmModified",new Date(),metaObject);
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        this.setFieldValByName("bmModified",new Date(),metaObject);

    }
}
/*
 *
 * @author Mr.Bao
 * @date 2021/8/14 22:23
 */